package com.hxd.otc.module.wallet.adapter;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.hxd.otc.R;
import com.hxd.otc.module.wallet.bean.TransferRecoderBean;
import com.hxd.otc.utils.DateUtil;
import com.hxd.otc.utils.StringUtil;
import com.hxd.otc.utils.UIUtils;

/**
 * 描  述 :  ${钱包记录 Adapter}
 */
public class TransferRecordAdapter extends BaseQuickAdapter<TransferRecoderBean.TransferRecoderData, BaseViewHolder> {

    public TransferRecordAdapter() {
        super(R.layout.list_item_transfer_record, null);
    }

    @Override
    protected void convert(BaseViewHolder helper, TransferRecoderBean.TransferRecoderData item) {
        helper.setText(R.id.tv_time, DateUtil.format(Long.parseLong(item.createDate), DateUtil.YY_MM_DD_HH_MM_SS));
        helper.setText(R.id.tv_number, StringUtil.format8Number(item.volume.doubleValue()) + item.coinSymbol);
        switch (item.status) {////"0:成功 1：失败 2、处理中")
            case 0:
                helper.setText(R.id.tv_statues, UIUtils.getContext().getString(R.string.successful_transfer));
                helper.setTextColor(R.id.tv_statues, UIUtils.getContext().getResources().getColor(R.color.color_FF464E5F));
                break;
            case 1:
            case 3:
                helper.setText(R.id.tv_statues, UIUtils.getContext().getString(R.string.fail_transfer));
                helper.setTextColor(R.id.tv_statues, UIUtils.getContext().getResources().getColor(R.color.color_FF464E5F));
                break;
            case 2:
                helper.setText(R.id.tv_statues, UIUtils.getContext().getString(R.string.processing));
                helper.setTextColor(R.id.tv_statues, UIUtils.getContext().getResources().getColor(R.color.color_FFFF4444));
                break;
        }

        String from = "";
        String to = "";
        switch (item.fromType) {//(value = "0:常规账户 1：法币账户 2、手续费备用金 3、ues交易所")
            case 0:
                from = UIUtils.getContext().getString(R.string.normal_account);
                break;
            case 1:
                from = UIUtils.getContext().getString(R.string.otc_account);
                break;
            case 2:
                from = UIUtils.getContext().getString(R.string.fee_reserve);
                break;
            case 3:
                from = UIUtils.getContext().getString(R.string.ues_exchange);
                break;
        }

        switch (item.toType) {//(value = "0:常规账户 1：法币账户 2、手续费备用金")
            case 0:
                to = UIUtils.getContext().getString(R.string.normal_account);
                break;
            case 1:
                to = UIUtils.getContext().getString(R.string.otc_account);
                break;
            case 2:
                to = UIUtils.getContext().getString(R.string.fee_reserve);
                break;
        }
        helper.setText(R.id.tv_content, UIUtils.getContext().getString(R.string.transfer_draw_out, from, to));
    }
}
